﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Xml.Linq;
using System.Data.SqlClient;
using QA_System.QASysDataSetTableAdapters;

namespace QA_System
{  
    public class InLocation
    {
        private static InLocationTableAdapter inlocationAdapter = new InLocationTableAdapter();

        public static QASysDataSet.InLocationDataTable GetAlldata()
        { 
            QASysDataSet.InLocationDataTable inlocationTable = inlocationAdapter.GetData();
            return inlocationTable;                
        }        
        
        public static InLocationfield GetByPaintingId(int paintingId)
        {
            QASysDataSet.InLocationDataTable inlocationTable = inlocationAdapter.GetDataByPaintingId(paintingId);
            if (inlocationTable.Rows.Count == 0)
                return null;
            else
            {
                InLocationfield FData = new InLocationfield();
                FData.Paint_ID = int.Parse(inlocationTable.Rows[0]["Paint_Id"].ToString());
                FData.Location = inlocationTable.Rows[0]["Location"].ToString();
                return (FData);
            }            
        }        
    }
}
